﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 生产计划批量打印工具
{
    public partial class frmLauncher : Form
    {
        string strFactoryName=string.Empty ;

        public frmLauncher()
        {
            InitializeComponent();
        }

        private void btn1_Click(object sender, EventArgs e)
        {
            frmContractToPlan newFrmContractToPlan = new frmContractToPlan(strFactoryName );
            newFrmContractToPlan.Owner = this;
            newFrmContractToPlan.Show();
            this.Hide();
        }

        private void btn2_Click(object sender, EventArgs e)
        {
            frmMain newFrmMain = new frmMain(strFactoryName);
            newFrmMain.Owner = this;
            newFrmMain.Show();
            this.Hide();
        }

        private void btn3_Click(object sender, EventArgs e)
        {
            frmOrderChanges newFrmOrderChanges = new frmOrderChanges(strFactoryName);
            newFrmOrderChanges.Owner = this;
            newFrmOrderChanges.Show();
            this.Hide();
        }

        private void frmLauncher_Load(object sender, EventArgs e)
        {
            cmbFactory.SelectedIndex = 生产计划批量打印工具.Properties.Settings.Default.DefaultFactory;
        }

        private void btnSetDefault_Click(object sender, EventArgs e)
        {
            生产计划批量打印工具.Properties.Settings.Default.DefaultFactory = cmbFactory.SelectedIndex;
            生产计划批量打印工具.Properties.Settings.Default.Save();
        }

        private void cmbFactory_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cmbFactory.SelectedIndex)
            {
                case 0:
                    strFactoryName = "603车间";
                    break;
                case 1:
                    strFactoryName = "601车间";
                    break;
                case 2:
                    strFactoryName = "微波车间";
                    break;
            }
        }

        private void btn4_Click(object sender, EventArgs e)
        {
            frmOrderChangesH newFrmOrderChangesH = new frmOrderChangesH(strFactoryName);
            newFrmOrderChangesH.Owner = this;
            newFrmOrderChangesH.Show();
            this.Hide();
        }

        private void btn5_Click(object sender, EventArgs e)
        {
            frmPrintList newFrmPrintList = new frmPrintList(strFactoryName);
            newFrmPrintList.Owner = this;
            newFrmPrintList.Show();
            this.Hide();
        }

        private void frmLauncher_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }
    }
}